package com.xiaozhen.cmdb.controller;

import com.xiaozhen.cmdb.service.CmdbExampleValueService;
import com.xiaozhen.security.controller.BaseController;
import com.xiaozhen.common.core.domain.AjaxResult;
import com.xiaozhen.common.core.domain.cmdb.CmdbExampleValue;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * HISTORY
 *
 * @author zhenweisheng
 * @date 2021/9/9 16:22
 * @description:
 */
@Api(tags = "Cmdb实例属性值接口")
@RestController
@RequestMapping("cmdbExampleValue")
public class CmdbExampleValueController extends BaseController {

    @Autowired
    private CmdbExampleValueService cmdbExampleValueService;

    @ApiOperation("添加或添加实例属性值信息")
    @PostMapping("/addCmdbExampleValues")
    public AjaxResult addCmdbExampleValues(@Validated @RequestBody List<CmdbExampleValue> list) {
        Long currentUserId = getCurrentUserId();
        return toAjax(cmdbExampleValueService.insertCmdbExampleValueList(list,currentUserId));
    }
}
